package com.hsj.stream02.listener;

import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.annotation.StreamListener;
import org.springframework.cloud.stream.messaging.Sink;
import org.springframework.messaging.Message;
import org.springframework.stereotype.Component;
import pojo.User;

/**
 * @author:Teacher黄
 * @date:Created at 2020/01/05
 */
@Component
@SuppressWarnings("all")
@EnableBinding(Sink.class)
public class MessageListener {

    @StreamListener(Sink.INPUT) // 监听输入
    public void input(Message<User> message){
        System.out.println("接收到了消息:"+message.getPayload());
    }

}
